package business.command.product
{
	import business.modelLocators.ProductModelLocator;
	import business.service.delegate.ProductAMDelegate;
	
	import com.adobe.cairngorm.commands.ICommand;
	import com.adobe.cairngorm.control.CairngormEvent;
	
	import mx.collections.ArrayCollection;
	import mx.rpc.IResponder;
	import mx.controls.Alert;
	public class GetAllCatedgoriesCommand implements ICommand, IResponder
	{
		public function GetAllCatedgoriesCommand()
		{
		}
		public function execute(event:CairngormEvent):void {
			var productAM:ProductAMDelegate = new ProductAMDelegate(this);
			productAM.getAllCategories();
		}
		public function result(result:Object):void {
			var productModel:ProductModelLocator = ProductModelLocator.getInstance();
			productModel.allCategoreis = result.result as ArrayCollection;
			Alert.show("The total num of categories is: "+productModel.allCategoreis.length.toString());
		}
		public function fault(info:Object):void {
			
		}
	}
}